//==========================================================================//
//                                                                          //
//  RTCDS1307 Library              Version 0.1                     March 2012  //
//                                                                          //
//  Written for the Arduino Duemilanove w/ ATmega328                        //
//                                                                          //
//  RTCDS1307 Arduino Library                                                  //
//                                                                          //
//  Created by JFLagarde (jeanfrancoislagarde@hotmail.com)                  //
//                                                                          //
//  This file is part of OpenWS (http://code.google.com/p/openws/)          //
//                                                                          //
//==========================================================================//
//                                                                          //
//  Notes:                                                                  //
//                                                                          //
//                                                                          //
//==========================================================================//
//                                                                          //
//  Copyright 2012 Jean-Francois Lagarde (jeanfrancoislagarde@hotmail.com)  //
//  This program is distributed under the terms of                          //
//  the GNU General Public License                                          //
//                                                                          //
//  This program is free software: you can redistribute it and/or modify    //
//  it under the terms of the GNU General Public License as published by    //
//  the Free Software Foundation, either version 3 of the License, or       //
//  (at your option) any later version.                                     //
//                                                                          //
//  This program is distributed in the hope that it will be useful,         //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of          //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           //
//  GNU General Public License for more details.                            //
//                                                                          //
//  You should have received a copy of the GNU General Public License       //
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.   //
//                                                                          //
//==========================================================================//


#include <Wire.h>
#include <RTCDS1307.h>

RTCDS1307 RTC = RTCDS1307();

void setup() {
  Serial.begin(9600);
  Serial.println("RTCDS1307 Library Demo");
  Serial.println();
  
  Wire.begin();
  RTC.setYear(12);
  RTC.setMonth(3);
  RTC.setDate(22);
  RTC.setHours(19);
  RTC.setMinutes(30);
  RTC.setSeconds(0);
  RTC.setClock();
  RTC.start();
}
 
void loop() {
  delay(1000);
  RTC.readClock();

	Serial.print(RTC.getYear());
	Serial.print("-");
	Serial.print(RTC.getMonth());
	Serial.print("-");
	Serial.print(RTC.getDate());
	Serial.print(" ");
	Serial.print(RTC.getHours());
	Serial.print(":");
	Serial.print(RTC.getMinutes());
	Serial.print(":");
	Serial.print(RTC.getSeconds());
	Serial.println();
}